#include "widget.h"
#include <QHBoxLayout>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    //qDebug()<< QDir::currentPath();
    //QSound::play("/dingding.wav");
    //QSound::play("/dongdong.wav");
    //gtcp = new TCPsev(this);
    //mynotic = new Notic(this);
    QHBoxLayout *h = new QHBoxLayout(this);
    h->addWidget(&gtcp.map);
    h->addWidget(&menu);
    connect(&menu,&Menu::changeSize,&gtcp.map,&Map::changeSize);
//    connect(&menu,&Menu::changeRode,&map,&Map::changeRoad);
    connect(&gtcp,&TCPsev::changeRoad,&gtcp.map,&Map::changeRoad);
    connect(&gtcp.map,&Map::closeWid,this,&Widget::closeWid);
    connect(&gtcp,&TCPsev::noticSound,&mynotic,&Notic::noticSound);
    connect(&menu,&Menu::noticSound,&mynotic,&Notic::noticSound);
    connect(&menu,&Menu::send_start,&gtcp,&TCPsev::send_start);
    connect(&gtcp,&TCPsev::setTips,&menu,&Menu::setTips);
    connect(&menu,&Menu::disconnectClient,&gtcp,&TCPsev::disconnectClient);


    setWindowTitle("Bci Board");


//    this->hide();
//    myn.show();
}



Widget::~Widget()
{
}

void Widget::closeWid()
{
    this->close();
}
